import sys
import json

sys.path.append('../')
from message.api import MessageService
from message.api.ttypes import *
from message.api.constants import *

from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol



if __name__ == '__main__':

    transport = TSocket.TSocket('localhost', 9090)
    transport = TTransport.TFramedTransport(transport)
    protocol = TBinaryProtocol.TBinaryProtocol(transport)
    client = MessageService.Client(protocol)

    # Connect!
    transport.open()

    mobile = '18836885295'
    message = 'test message'
    client.sendMobileMessage(mobile, message)

    transport.close()

    print('[INFO]: sendMobileMessage: {0}, {1}'.format(mobile, message))
